/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Logico;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author usuario
 */
@Entity
@Table(name = "usuario")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Usuario.findAll", query = "SELECT u FROM Usuario u"),
    @NamedQuery(name = "Usuario.findByCedula", query = "SELECT u FROM Usuario u WHERE u.cedula = :cedula"),
    @NamedQuery(name = "Usuario.findByNombre", query = "SELECT u FROM Usuario u WHERE u.nombre = :nombre"),
    @NamedQuery(name = "Usuario.findByApellidos", query = "SELECT u FROM Usuario u WHERE u.apellidos = :apellidos"),
    @NamedQuery(name = "Usuario.findByRol", query = "SELECT u FROM Usuario u WHERE u.rol = :rol"),
    @NamedQuery(name = "Usuario.findByContrasena", query = "SELECT u FROM Usuario u WHERE u.contrasena = :contrasena")})
public class Usuario implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "cedula")
    private Integer cedula;
    @Column(name = "nombre")
    private String nombre;
    @Column(name = "apellidos")
    private String apellidos;
    @Column(name = "rol")
    private String rol;
    @Column(name = "contrasena")
    private String contrasena;
    @ManyToMany(mappedBy = "usuarioList")
    private List<Competencia> competenciaList;
    @ManyToMany(mappedBy = "usuarioList1")
    private List<Competencia> competenciaList1;
    @OneToMany(mappedBy = "ceduladirectorlogistica")
    private List<Evento> eventoList;
    @OneToMany(mappedBy = "ceduladirectoradministrativo")
    private List<Evento> eventoList1;
    @OneToMany(mappedBy = "ceduladirectordeportivo")
    private List<Evento> eventoList2;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "ceduladirectorevento")
    private List<Evento> eventoList3;

    public Usuario() {
    }

    public Usuario(Integer cedula) {
        this.cedula = cedula;
    }

    public Integer getCedula() {
        return cedula;
    }

    public void setCedula(Integer cedula) {
        this.cedula = cedula;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public String getApellidos() {
        return apellidos;
    }

    public void setApellidos(String apellidos) {
        this.apellidos = apellidos;
    }

    public String getRol() {
        return rol;
    }

    public void setRol(String rol) {
        this.rol = rol;
    }

    public String getContrasena() {
        return contrasena;
    }

    public void setContrasena(String contrasena) {
        this.contrasena = contrasena;
    }

    @XmlTransient
    public List<Competencia> getCompetenciaList() {
        return competenciaList;
    }

    public void setCompetenciaList(List<Competencia> competenciaList) {
        this.competenciaList = competenciaList;
    }

    @XmlTransient
    public List<Competencia> getCompetenciaList1() {
        return competenciaList1;
    }

    public void setCompetenciaList1(List<Competencia> competenciaList1) {
        this.competenciaList1 = competenciaList1;
    }

    @XmlTransient
    public List<Evento> getEventoList() {
        return eventoList;
    }

    public void setEventoList(List<Evento> eventoList) {
        this.eventoList = eventoList;
    }

    @XmlTransient
    public List<Evento> getEventoList1() {
        return eventoList1;
    }

    public void setEventoList1(List<Evento> eventoList1) {
        this.eventoList1 = eventoList1;
    }

    @XmlTransient
    public List<Evento> getEventoList2() {
        return eventoList2;
    }

    public void setEventoList2(List<Evento> eventoList2) {
        this.eventoList2 = eventoList2;
    }

    @XmlTransient
    public List<Evento> getEventoList3() {
        return eventoList3;
    }

    public void setEventoList3(List<Evento> eventoList3) {
        this.eventoList3 = eventoList3;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (cedula != null ? cedula.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Usuario)) {
            return false;
        }
        Usuario other = (Usuario) object;
        if ((this.cedula == null && other.cedula != null) || (this.cedula != null && !this.cedula.equals(other.cedula))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Logico.Usuario[ cedula=" + cedula + " ]";
    }
    
}
